const Router = require('koa-router')
const { auth } = require('../middle/auth')
const router = new Router({
  prefix: '/topic'
})

const { getTopiclist, createTopic, updateTopic, getTopic, listQuestion} = require('../controllers/topic')

router.get('/', getTopiclist)

router.get('/:id', getTopic)

router.get('/:id/questions', listQuestion)

router.post('/', auth, createTopic)

router.patch('/:id', auth, updateTopic)


module.exports = router